import { getActionBasic, deleteActionBasic, putActionBasic, postActionBasic } from '@/api/manage'

/// /根路径
// const doMian = '/fx-platform'
/// /图片预览请求地址
// const imgView = "http://localhost:8101/fx-platform/sys/common/view/";
// 字典标签专用（通过code获取字典数组）
export const ajaxGetDictItems = (code, params) => getActionBasic(`/basic-business/sys/dict/getDictItems/${code}`, params)

// 加载弹出表单
const getColumns = (code, params) => getActionBasic(code + '/online/cgreport/api/getRpColumns/' + params)
const getData = params => getActionBasic('/basic-business/online/cgreport/api/getData/' + params)
const getQueryInfo = params => getActionBasic('/basic-business/online/cgreport/api/getQueryInfo/' + params)

// 加载分类字典
const loadCategoryData = (params) => getActionBasic('/basic-business/sys/category/loadAllData', params)
const loadTreeCategoryData = (params) => getActionBasic('/basic-business/sys/category/treeList', params)
const checkRuleByCode = (params) => getActionBasic('/basic-business/sys/checkRule/checkByCode', params)
const addDict = (params) => postActionBasic('/basic-business/sys/dict/add', params)
const editDict = (params) => putActionBasic('/basic-business/sys/dict/edit', params)
const addDictItem = (params) => postActionBasic('/basic-business/sys/dictItem/add', params)
const editDictItem = (params) => putActionBasic('/basic-business/sys/dictItem/edit', params)
// 重复校验
const duplicateCheck = (params,code) => {
  if(code){
    return getActionBasic(code+'/sys/duplicate/check', params)
  }else{
    return getActionBasic('/basic-business/sys/duplicate/check', params)
  }
}
// 用户信息
const getUserList = (params) => getActionBasic('/poros-permission/secStaff/list', params)
// const getUserList = (params) => getActionBasic('/basic-business/sys/user/list', params)
const queryUserByDepId = (params) => getActionBasic('/basic-business/sys/user/queryUserByDepId', params)
const getUserByUid = (params) => getActionBasic('/poros-permission/secStaff/getUserByUid/'+ params)
const getOrgByCodes = (params) => getActionBasic('/poros-permission/secOrg/info', params)
// const queryDepartTreeList = (params) => getActionBasic('/basic-business/sys/sysDepart/queryTreeList', params)
const queryDepartTreeList = (params) => getActionBasic('/poros-permission/secOrg/list', params)
export {
  addDict,
  editDict,
  addDictItem,
  editDictItem,
  duplicateCheck,
  getColumns,
  getData,
  getQueryInfo,
  loadCategoryData,
  loadTreeCategoryData,
  checkRuleByCode,
  getUserList,
  queryUserByDepId,
  queryDepartTreeList,
  getUserByUid,
  getOrgByCodes
}
